///PHILOTES Source Code.  (C)2012 PhiloLabs
#pragma once

#ifndef __InstanceBatchHW_H__
#define __InstanceBatchHW_H__

#include "OgreInstanceBatch.h"

namespace Ogre
{
	
	

	
	class _OgreExport InstanceBatchHW : public InstanceBatch
	{
		bool	mKeepStatic;

		void setupVertices( const SubMesh* baseSubMesh );
		void setupIndices( const SubMesh* baseSubMesh );

		void removeBlendData();
		virtual bool checkSubMeshCompatibility( const SubMesh* baseSubMesh );

		size_t updateVertexBuffer( Camera *currentCamera );

	public:
		InstanceBatchHW( InstanceManager *creator, MeshPtr &meshReference, const MaterialPtr &material,
							size_t instancesPerBatch, const Mesh::IndexMap *indexToBoneMap,
							const String &batchName );
		virtual ~InstanceBatchHW();

		
		size_t calculateMaxNumInstances( const SubMesh *baseSubMesh, uint16 flags ) const;

		
		void buildFrom( const SubMesh *baseSubMesh, const RenderOperation &renderOperation );

		
		void _boundsDirty(void);

		
		void setStaticAndUpdate( bool bStatic );

		bool isStatic() const						{ return mKeepStatic; }

		//Renderable overloads
		void getWorldTransforms( Matrix4* xform ) const;
		unsigned short getNumWorldTransforms(void) const;

		
		virtual void _updateRenderQueue( RenderQueue* queue );
	};
}

#endif
